WPS Office.apk(点击下载) / AdAlertReporter.java


package com.mopub.mobileads;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.util.Base64;
import android.view.View;
import cn.wps.moffice.OfficeApp;
import com.mopub.common.AdReport;
import com.mopub.common.logging.MoPubLog;
import com.mopub.common.util.DateAndTime;
import com.mopub.common.util.Streams;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Locale;
import org.eclipse.paho.client.mqttv3.internal.ClientDefaults;

public class AdAlertReporter {
    private String BaI;
    private final String Bkr = new SimpleDateFormat("M/d/yy hh:mm:ss a z", Locale.US).format(DateAndTime.now());
    private Intent Bks;
    private ArrayList<Uri> Bkt = new ArrayList<>();
    private String Bku;
    private final Context mContext;
    private final View mView;

    /* JADX DEBUG: Multi-variable search result rejected for r0v7, resolved type: android.graphics.Bitmap */
    /* JADX DEBUG: Multi-variable search result rejected for r0v15, resolved type: android.graphics.Bitmap */
    /* JADX DEBUG: Multi-variable search result rejected for r0v21, resolved type: android.graphics.Bitmap */
    /* JADX WARN: Multi-variable type inference failed */
    public AdAlertReporter(Context context, View view, AdReport adReport) {
        Bitmap bitmap;
        FileOutputStream fileOutputStream = null;
        this.mView = view;
        this.mContext = context;
        Uri parse = Uri.parse("mailto:");
        this.Bks = new Intent("android.intent.action.SEND_MULTIPLE");
        this.Bks.setDataAndType(parse, "plain/text");
        this.Bks.putExtra("android.intent.extra.EMAIL", new String[]{"creative-review@mopub.com"});
        if (this.mView == null || this.mView.getRootView() == null) {
            bitmap = fileOutputStream;
        } else {
            View rootView = this.mView.getRootView();
            boolean isDrawingCacheEnabled = rootView.isDrawingCacheEnabled();
            rootView.setDrawingCacheEnabled(true);
            Bitmap drawingCache = rootView.getDrawingCache();
            if (drawingCache == null) {
                bitmap = fileOutputStream;
            } else {
                Bitmap createBitmap = Bitmap.createBitmap(drawingCache);
                rootView.setDrawingCacheEnabled(isDrawingCacheEnabled);
                bitmap = createBitmap;
            }
        }
        String al = al(bitmap);
        this.BaI = "";
        this.Bku = "";
        if (adReport != null) {
            this.BaI = adReport.toString();
            this.Bku = adReport.getResponseString();
        }
        this.Bks.putExtra("android.intent.extra.SUBJECT", "New creative violation report - " + this.Bkr);
        ae(this.BaI, this.Bku, al);
        ip("mp_adalert_parameters.txt", this.BaI);
        ip("mp_adalert_markup.html", this.Bku);
        if (bitmap != 0) {
            try {
                fileOutputStream = this.mContext.openFileOutput("mp_adalert_screenshot.png", 1);
                bitmap.compress(Bitmap.CompressFormat.PNG, 25, fileOutputStream);
                this.Bkt.add(cxe.a(new File(this.mContext.getFilesDir() + File.separator + "mp_adalert_screenshot.png"), OfficeApp.arx()));
            } catch (Exception e) {
                MoPubLog.d("Unable to write text attachment to file: " + "mp_adalert_screenshot.png");
            } finally {
                Streams.closeStream(fileOutputStream);
            }
        }
    }

    private void ae(String... strArr) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 3; i++) {
            sb.append(strArr[i]);
            if (i != 2) {
                sb.append("\n=================\n");
            }
        }
        this.Bks.putExtra("android.intent.extra.TEXT", sb.toString());
    }

    private static String al(Bitmap bitmap) {
        if (bitmap == null) {
            return null;
        }
        try {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            bitmap.compress(Bitmap.CompressFormat.JPEG, 25, byteArrayOutputStream);
            return Base64.encodeToString(byteArrayOutputStream.toByteArray(), 0);
        } catch (Exception e) {
            return null;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:10:0x0058, code lost:
        com.mopub.common.util.Streams.closeStream(null);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:11:0x005c, code lost:
        r1 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:12:0x005d, code lost:
        r1 = null;
        r0 = r1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:19:?, code lost:
        return;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:?, code lost:
        com.mopub.common.logging.MoPubLog.d("Unable to write text attachment to file: " + r6);
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Removed duplicated region for block: B:7:0x0045 A[ExcHandler: Exception (e java.lang.Exception), Splitter:B:2:0x0004] */
    private void ip(String str, String str2) {
        if (str2 != null) {
            try {
                FileOutputStream openFileOutput = this.mContext.openFileOutput(str, 1);
                openFileOutput.write(str2.getBytes());
                this.Bkt.add(cxe.a(new File(this.mContext.getFilesDir() + File.separator + str), OfficeApp.arx()));
                Streams.closeStream(openFileOutput);
            } catch (Exception e) {
            } catch (Throwable th) {
                Closeable closeable = null;
                Throwable th2 = th;
                Streams.closeStream(closeable);
                throw th2;
            }
        }
    }

    public void send() {
        this.Bks.putParcelableArrayListExtra("android.intent.extra.STREAM", this.Bkt);
        Intent createChooser = Intent.createChooser(this.Bks, "Send Email...");
        createChooser.addFlags(ClientDefaults.MAX_MSG_SIZE);
        this.mContext.startActivity(createChooser);
    }
}